package net.sinodata.smartframework.util;

import net.sinodata.smartframework.entity.ServerInfo;

/**
 * Description: 系统参数配置文件 读取param-config-*.properties中配置参数
 * 
 * @author: yinliangyun
 * @date: 2021-5-18
 */
public class ParamConfigUtils {

	public static String SERVER_NAME;
	public static String SERVER_IP;
	public static String SERVER_PORT;
    
	static {
		SERVER_NAME = PropertiesUtils.getInstance().getProperty("server.name");
		SERVER_IP = PropertiesUtils.getInstance().getProperty("server.ip");
		SERVER_PORT = PropertiesUtils.getInstance().getProperty("server.port");
	}
	
	public static boolean isLocalServer(ServerInfo serverInfo) {
		return SERVER_IP.equals(serverInfo.getServerIp()) && SERVER_PORT.equals(serverInfo.getServerPort()) && SERVER_NAME.equals(serverInfo.getServerName());
	}
	
	public static String getLocalServerURL() {
		String localServerURL = SERVER_IP + ":" + SERVER_PORT + ":" + SERVER_NAME;
		return localServerURL;
	}

}
